@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@200&family=Sacramento&display=swap');

h2 {
  color: #E15FED;
}

body {
  font-family: 'Montserrat', sans-serif;
  background-color: #F4FCD9;
}

padding { 
  10px
}


Story about the data


##Data 1

spotify_data <- fromJSON("spotify.json") %>%
  mutate(popularity = ifelse(track_popularity < 20, "Low popularity", "High popularity")) %>% mutate(year_released = str_sub(release_date, 1, 4) %>% as.numeric()) %>% arrange(desc(track_popularity)) %>% slice(1:100)

plot1 <- ggplot(data = spotify_data) + geom_jitter(aes(x = year_released, y = popularity, colour = popularity)) + labs(title = "When has BTS music become popular in the world?", x = "Song released year", y = "Song popularity", caption = "Data source : Spotify playlist") + theme(panel.background = element_rect(fill = "#E8F9FD")) + facet_wrap(vars(popularity)) + xlim(2012, 2022)


## gganimate visualisations
plot1 + transition_reveal(year_released)


##Data 2

best_bts_song <- spotify_data %>% select(track_name, track_album_name, artist_name, track_popularity)
  
summarised_data <- best_bts_song %>% group_by(track_album_name) %>% summarise(song_count = n()) %>% arrange(desc(song_count)) %>% slice(1:10)

plot2 <- summarised_data %>% ggplot(aes(song_count, track_album_name)) + geom_col(aes(fill = song_count), position = "dodge") + labs(title = "Which BTS album was the most popular in the world?", x = "Hit count", y = "Album name", caption = "Data source : Spotify playlist") + theme(panel.background = element_rect(fill = "#E8F9FD"))

plot2